package cn.dujc.superkid.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author du
 * date 2018/8/2 下午2:50
 */
public class ContactResult implements Parcelable {
    /**
     * title : 联系客服 制定你的学习计划
     * contact : [{"name":"微信公众号","picurl":"http://www.niuwaketang.com/Public/Images/t1.png"}]
     * telephone : 021-60522290 (工作日9：30-18：00)
     * customerService : 18616244360（牛爸）
     * address : 上海市紫竹高科技园区东川路555号6号楼405室
     */

    private String title;//标题
    private String telephone;//联系电话
    private String customerService;//24小时客服
    private String address;//地址
    private List<ContactEntity> contact;

    public String getTitle() { return title;}

    public void setTitle(String title) { this.title = title;}

    public String getTelephone() { return telephone;}

    public void setTelephone(String telephone) { this.telephone = telephone;}

    public String getCustomerService() { return customerService;}

    public void setCustomerService(String customerService) { this.customerService = customerService;}

    public String getAddress() { return address;}

    public void setAddress(String address) { this.address = address;}

    public List<ContactEntity> getContact() { return contact;}

    public void setContact(List<ContactEntity> contact) { this.contact = contact;}

    @Override
    public int describeContents() { return 0; }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.title);
        dest.writeString(this.telephone);
        dest.writeString(this.customerService);
        dest.writeString(this.address);
        dest.writeTypedList(this.contact);
    }

    public ContactResult() {}

    protected ContactResult(Parcel in) {
        this.title = in.readString();
        this.telephone = in.readString();
        this.customerService = in.readString();
        this.address = in.readString();
        this.contact = in.createTypedArrayList(ContactEntity.CREATOR);
    }

    public static final Creator<ContactResult> CREATOR = new Creator<ContactResult>() {
        @Override
        public ContactResult createFromParcel(Parcel source) {return new ContactResult(source);}

        @Override
        public ContactResult[] newArray(int size) {return new ContactResult[size];}
    };

    public static class ContactEntity implements Parcelable{
        /**
         * name : 微信公众号
         * picurl : http://www.niuwaketang.com/Public/Images/t1.png
         */

        private String name;//公众号名
        private String picurl;//图片地址

        public String getName() { return name;}

        public void setName(String name) { this.name = name;}

        public String getPicurl() { return picurl;}

        public void setPicurl(String picurl) { this.picurl = picurl;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.name);
            dest.writeString(this.picurl);
        }

        public ContactEntity() {}

        protected ContactEntity(Parcel in) {
            this.name = in.readString();
            this.picurl = in.readString();
        }

        public static final Creator<ContactEntity> CREATOR = new Creator<ContactEntity>() {
            @Override
            public ContactEntity createFromParcel(Parcel source) {return new ContactEntity(source);}

            @Override
            public ContactEntity[] newArray(int size) {return new ContactEntity[size];}
        };
    }

}
